package cn.ac.jaas.isc.vegetable.quartz.config;

import cn.ac.jaas.isc.vegetable.quartz.entity.SysJob;
import cn.ac.jaas.isc.vegetable.quartz.event.SysJobEvent;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.annotation.Aspect;
import org.quartz.Trigger;
import org.springframework.context.ApplicationEventPublisher;

/**
 * @author 张高昌
 * @date 2022/4/30 16:17
 * @description: 功能描述
 */
@Aspect
@Slf4j
@AllArgsConstructor
public class VegetableQuartzInvokeFactory {

    private final ApplicationEventPublisher publisher;

    @SneakyThrows
    void init(SysJob sysJob, Trigger trigger) {
        publisher.publishEvent(new SysJobEvent(sysJob, trigger));
    }
}
